package com.mindspore.styletransferdemo;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.widget.ImageView;

import androidx.appcompat.app.AppCompatActivity;

import com.bumptech.glide.Glide;

public class TestActivity extends AppCompatActivity {

    private ImageView img1, img2, img3;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test);

        img1 = findViewById(R.id.img1);
        img2 = findViewById(R.id.img2);
        img3 = findViewById(R.id.img3);

        Bitmap bitmap1 = BitmapFactory.decodeResource(getResources(),R.drawable.person);
        Glide.with(this).load(bitmap1).into(img1);

        Bitmap bitmap2 =
                ImageUtils.loadBitmapFromResources(this, "thumbnails/style16.jpg");
        Glide.with(this).load(bitmap2).into(img2);


        StyleTransferModelExecutor transferModelExecutor = new StyleTransferModelExecutor(this, false);
        ModelExecutionResult result = transferModelExecutor.execute(bitmap1,bitmap2);
        Glide.with(this).load(result.getStyledImage()).into(img3);
    }
}